﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <!-- Top Menu style -->
    <Style x:Key="TopMenuStyle" TargetType="Menu">
        <Setter Property="Background" Value="#FF3A3A3A" />
    </Style>

    <Style x:Key="TopMenuItemStyle" TargetType="MenuItem">
        <Setter Property="Background" Value="#FF3A3A3A" />
        <Setter Property="Foreground" Value="White" />
    </Style>

    <Style x:Key="TopCloseButtonStyle" TargetType="Button">
        <Setter Property="Background" Value="#FF3A3A3A" />
        <Setter Property="Foreground" Value="White" />
        <Setter Property="FontFamily" Value="Tahoma" />
        <Setter Property="BorderBrush" Value="{x:Null}" />
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="FontWeight" Value="Bold" />
            </Trigger>
        </Style.Triggers>
    </Style>
    
    <!-- Flyout Panel Style -->
    <DataTemplate x:Key="MenuHeaderTemplate">
        <TextBlock Text="{Binding}" FontSize="19" />
    </DataTemplate>

    <Style TargetType="{x:Type Frame}">
        <Setter Property="Focusable" Value="False" />
    </Style>
    <!-- 
    this style is based on the TabItem template, removed styles and triggers that are targeted to 
    others than TabItem.TabStripPlacement = Dock.Right 
    -->
    <Style x:Key="ControlPanelTabItemStyle" TargetType="{x:Type TabItem}">
        <Setter Property="BorderBrush" Value="#7E7E7E"/>
        <Setter Property="HeaderTemplate" Value="{StaticResource MenuHeaderTemplate}" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
                    <GradientStop Color="Black" Offset="0" />
                    <GradientStop Color="#1B1E1C" Offset="0.5" />
                    <GradientStop Color="#363636" Offset="0.5" />
                    <GradientStop Color="#535353" Offset="1" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="MinWidth" Value="80" />
        <Setter Property="LayoutTransform">
            <Setter.Value>
                <RotateTransform x:Name="MyRotateTransform" Angle="90" />
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid SnapsToDevicePixels="True">
                        <Border
                BorderBrush="{TemplateBinding Border.BorderBrush}"
                CornerRadius="6,6,0,0"
                BorderThickness="0,0,0,0"
                Margin="0,0,0,1" 
                Name="Bd"
                Background="{TemplateBinding Panel.Background}"
                Padding="{TemplateBinding Control.Padding}">
                            <ContentPresenter
                  ContentSource="Header"
                  HorizontalAlignment="Center"
                  Name="Content"
                  VerticalAlignment="Stretch"
                  SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"
                  ContentTemplate="{TemplateBinding HeaderedContentControl.HeaderTemplate}"
                  RecognizesAccessKey="True"
                  Content="{TemplateBinding HeaderedContentControl.Header}" />
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>

                        <!-- mouse is over -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="UIElement.IsMouseOver" Value="True" />
                                <Condition Property="Selector.IsSelected" Value="False" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Panel.Background" TargetName="Bd">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,1" EndPoint="0,0" >
                                        <GradientStop Color="#1B1E1C" Offset="0" />
                                        <GradientStop Color="#E1E4E4" Offset="1" />
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </MultiTrigger>

                        <!-- tab is selected -->
                        <Trigger Property="Selector.IsSelected" Value="True">
                            <Setter Property="Panel.ZIndex" Value="1" />
                            <Setter Property="Border.BorderThickness" TargetName="Bd" Value="1,1,1,0" />
                            <Setter Property="FrameworkElement.Margin" Value="-2,0,0,0" />
                        </Trigger>

                        <!-- item is not selected -->
                        <Trigger Property="Selector.IsSelected" Value="False">
                            <Setter Property="FrameworkElement.Margin" Value="-1,1,0,1" />
                        </Trigger>

                        <!-- 
            If first tab (the one with ? mark), turn its content -90 degrees. all tabs are 
            rotated 90 degrees. by rotating ContentPresenter -90, question mark will be right way around.
            -->
                        <Trigger Property="FrameworkElement.Tag" Value="True">
                            <Setter Property="FrameworkElement.MinWidth" Value="0" />
                            <Setter Property="ContentPresenter.LayoutTransform" TargetName="Content">
                                <Setter.Value>
                                    <RotateTransform Angle="-90" />
                                </Setter.Value>
                            </Setter>
                            <!-- set vertical alignment so question mark will be in the middle of the tab -->
                            <Setter Property="ContentPresenter.VerticalAlignment" Value="Center" TargetName="Content" />
                        </Trigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
    this style is based on the TabItem template, removed styles and triggers that are targeted to 
    others than TabItem.TabStripPlacement = Dock.Right. If TabStripPlacement changed for control using
    this style, it changes nothing.
    -->
    <Style x:Key="ControlPanelTabControlStyle" TargetType="{x:Type TabControl}">
        <Setter Property="BorderBrush" Value="#7E7E7E"/>
        <Setter Property="BorderThickness" Value="0,1,1,1" />
        <Setter Property="Background" Value="Black" />
        <Setter Property="Margin" Value="0 30 0 0" />
        <Setter Property="TabStripPlacement" Value="Right" />
        <Setter Property="Width" Value="450" />
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Top" />
        <Setter Property="Padding" Value="25" />
        <Setter Property="IsTabStop" Value="False" />

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TabControl">
                    <Grid ClipToBounds="True" SnapsToDevicePixels="True" KeyboardNavigation.TabNavigation="Local">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <TabPanel
                IsItemsHost="True"
                Name="HeaderPanel"
                Margin="0,0,0,0" 
                Panel.ZIndex="1"
                KeyboardNavigation.TabIndex="1"
                Grid.Column="1"
                Grid.Row="0" />
                        <Border
                BorderBrush="{TemplateBinding Border.BorderBrush}"
                BorderThickness="{TemplateBinding Border.BorderThickness}"
                Name="ContentPanel"
                Background="{TemplateBinding Panel.Background}"
                KeyboardNavigation.TabIndex="2"
                KeyboardNavigation.TabNavigation="Local"
                KeyboardNavigation.DirectionalNavigation="Contained"
                Grid.Column="0"
                Grid.Row="0">
                            <ContentPresenter
                  ContentSource="SelectedContent"
                  Margin="{TemplateBinding Control.Padding}"
                  Name="PART_SelectedContentHost"
                  SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"
                  ContentTemplate="{TemplateBinding TabControl.SelectedContentTemplate}"
                  Content="{TemplateBinding TabControl.SelectedContent}" />
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>